package com.tyk.bookstore.back.task.model.query;

import com.tyk.bookstore.back.task.model.constant.TaskValidateConstant;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;


/**
 * @author tyk
 * @description 定时任务
 */
@Data
@Schema(name = "TaskUpdateQuery", description = "定时任务")
public class TaskUpdateQuery implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "ID")
    @NotNull
    @Min(value = 1)
    private Long id;

    @Schema(description = "名称")
    @NotBlank
    @Size(min = TaskValidateConstant.NAME_MIN_LENGTH, max = TaskValidateConstant.NAME_MAX_LENGTH)
    @Pattern(regexp = TaskValidateConstant.NAME_REGEXP)
    private String name;

    @Schema(description = "模块")
    @NotBlank
    @Size(min = TaskValidateConstant.MODULE_MIN_LENGTH, max = TaskValidateConstant.MODULE_MAX_LENGTH)
    @Pattern(regexp = TaskValidateConstant.MODULE_REGEXP)
    private String module;

    @Schema(description = "方法")
    @NotBlank
    @Size(min = TaskValidateConstant.METHOD_MIN_LENGTH, max = TaskValidateConstant.METHOD_MAX_LENGTH)
    @Pattern(regexp = TaskValidateConstant.METHOD_REGEXP)
    private String method;

    @Schema(description = "Cron表达式")
    @NotBlank
    @Size(min = TaskValidateConstant.CRON_MIN_LENGTH, max = TaskValidateConstant.CRON_MAX_LENGTH)
    @Pattern(regexp = TaskValidateConstant.CRON_REGEXP)
    private String cron;

    @Schema(description = "描述")
    @NotBlank
    @Size(min = TaskValidateConstant.DESCRIPTION_MIN_LENGTH, max = TaskValidateConstant.DESCRIPTION_MAX_LENGTH)
    @Pattern(regexp = TaskValidateConstant.DESCRIPTION_REGEXP)
    private String description;


}
